using BCW;
using I2.Loc;
using UnityEngine;

public class PromoRewardUI : MonoBehaviour
{
	[SerializeField]
	private UILabel rewardName;

	[SerializeField]
	private UILabel rewardAmount;

	[SerializeField]
	private UIBasicSprite rewardTexture;

	public void SetUI(string id, int amount)
	{
		rewardTexture = rewardTexture.ReplaceForCurrentPlatform();
		if (string.IsNullOrEmpty(id))
		{
			base.gameObject.SetActive(false);
			return;
		}
		base.gameObject.SetActive(true);
		rewardName.text = ScriptLocalization.Get("Market/" + id + "_title");
		if (amount > 0)
		{
			rewardAmount.text = "+" + amount;
			rewardAmount.gameObject.SetActive(true);
		}
		else
		{
			rewardAmount.text = string.Empty;
			rewardAmount.gameObject.SetActive(false);
		}
		switch (id)
		{
		case "cash":
			rewardTexture.LoadTextureAndAlphaMask("NGUI_Textures/", "cash");
			break;
		case "gold":
			rewardTexture.LoadTextureAndAlphaMask("NGUI_Textures/", "gold");
			break;
		default:
			rewardTexture.LoadTextureAndAlphaMask("AtlasShopGuns/", MarketController.Instance.GetProduct(id).texture);
			break;
		}
	}
}
